<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>verification-fun</title>
    <style>
        .test{
            width: 100%;
        }
        .test_box{
            width: 300px;
            height: 40px;
            background: blueviolet;
        }
        .JigsawCode{
            width: 310px;
            height: 200px;
        }
        .test_title{
            font-size: 16px;
            color: #000;
            font-weight: 600;
            margin-bottom: 10px;
            margin-top: 10px;
        }
    </style>
</head>
<body>
<div class="test">
    <div class="test_title" id="StrImgCode_title">数字字母组合验证码</div>
    <img src="" id="StrImgCode" alt="">
    <div class="test_title" id="CountImgCode_title">数字字母组合验证码</div>
    <img src="" id="CountImgCode" alt="">
    <div class="test_title" id="SlideCode_title">滑动条验证码</div>
    <div class="test_box" id="test_box"></div>
    <div class="test_title" id="JigsawCode_title">拼图验证码</div>
    <div class="JigsawCode" id="JigsawCode"></div>
</div>
</body>
</html>
<script src="./com.verifyCode.js"></script>
<script>
    let {StrImgCode, CountImgCode, SlideCode, JigsawCode} = verifyCode;
    // 数字字母组合验证码
    let test = new StrImgCode();
    let a = test.create();
    document.getElementById('StrImgCode').src = a.imgUrl;
    document.getElementById('StrImgCode_title').innerHTML += '  [ ' + a.imgCode + ' ]  ';

    // 算术验证码
    let test1 = new CountImgCode();
    let b = test1.create();
    document.getElementById('CountImgCode').src = b.imgUrl;
    document.getElementById('CountImgCode_title').innerHTML += '  [ ' + b.imgCode + ' ]  ';

    // 滑动条验证码
    new SlideCode({
        dom : document.getElementById('test_box'),
        id : 'box',
        success : function () {
            document.getElementById('SlideCode_title').innerHTML += '  [ 验证成功 ]  ';
        },
        error : function () {
            document.getElementById('SlideCode_title').innerHTML += '  [ 验证失败 ]  ';
        },
    });

    // 拼图验证码
    let test3 = new JigsawCode({
        dom : document.getElementById('JigsawCode'),
        id : 'JigsawCode_box',
        success : function () {
            document.getElementById('JigsawCode_title').innerHTML += '  [ 验证成功 ]  ';
        },
        error : function () {
            document.getElementById('JigsawCode_title').innerHTML += '  [ 验证失败 ]  ';
        },
    });
    test3.create();
</script>
